package pro.shushi.pamirs.hr.api.model.org;

import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.IdModel;

@Model.model(Position.MODEL_MODEL)
@Model(displayName = "标品-岗位", labelFields = "name")
// 模型编码，参考：https://doc.oinone.top/oio4/9236.html
@Model.Code(sequence = "SEQ", prefix = "P", size = 5, step = 1, initial = 10000)
@Model.Advanced(unique = {"departmentCode, code"})
public class Position extends IdModel {

    public static final String MODEL_MODEL = "hr.simple.Position";

    @Field(displayName = "编码", invisible = true, unique = true)
    private String code;

    @Field.String
    @Field(displayName = "岗位名称", required = true)
    private String name;

    @Field.Text
    @Field(displayName = "岗位描述", required = true)
    private String spec;

    @Field.many2one
    @Field.Relation(relationFields = {"departmentCode"}, referenceFields = {"code"})
    @Field(displayName = "所属部门")
    private Department department;

    @Field.String
    @Field(displayName = "所属部门编码", invisible = true)
    private String departmentCode;
}
